package com.icez.base_compose_framework

import androidx.compose.material3.AlertDialog
import androidx.compose.material3.Text
import androidx.compose.material3.TextButton
import androidx.compose.material3.adaptive.currentWindowAdaptiveInfo
import androidx.compose.runtime.Composable
import androidx.navigation.compose.NavHost
import androidx.window.layout.DisplayFeature

@Composable
fun BaseApp(displayFeature:List<DisplayFeature>, appState: BaseAppState = BRememberAppState(),content: @Composable (appState:BaseAppState) -> Unit){
    val adaptiveInfo = currentWindowAdaptiveInfo()
    if (appState.isOnline){
        content(appState)
    }else{
        AlertDialog(onDismissRequest = {}, confirmButton = {
            TextButton(onClick = {
                appState.refreshOnline()
            }) {
                Text(text = "重试")
            }
        }, title = {
            Text(text = "网络异常")
        }, text = {
            Text(text = "请检测网络！")
        })
    }
}